<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

use Hyperf\ConfigCenter\Mode;

use function Hyperf\Support\env;

return [
    'enable' => (bool) env('CONFIG_CENTER_ENABLE', true),
    'driver' => env('CONFIG_CENTER_DRIVER', 'nacos'),
    'mode' => env('CONFIG_CENTER_MODE', Mode::PROCESS),
    'drivers' => [
        'nacos' => [
            'driver' => Hyperf\ConfigNacos\NacosDriver::class,
            'merge_mode' => Hyperf\ConfigNacos\Constants::CONFIG_MERGE_OVERWRITE,
            'interval' => 3,
            'default_key' => 'nacos_config',
            'listener_config' => [ // 最终会和并成的配置
                'nacos_config' => [
                    'tenant' => 'public', //  相应的命名空间
                    'data_id' => 'hyperf-service-config',
                    'group' => 'DEFAULT_GROUP',
                    'type' => 'yml',
                ],
                'redis' => [ // 覆盖redis.php的内容
                    'data_id' => 'redis',
                    'group' => 'DEFAULT_GROUP',
                    'type' => 'yml',
                ],
                'config.remote' => [
                    'data_id' => 'hyperf-service-remote-config-yml',
                    'group' => 'DEFAULT_GROUP',
                    'type' => 'yml',
                ],
                'nacos_config.data' => [
                    'data_id' => 'hyperf-service-config-yml',
                    'group' => 'DEFAULT_GROUP',
                    'type' => 'yml',
                ],
            ],
        ],
    ],
];
